package com.dg11185.nearshop.net.request;

import com.dg11185.libs.utils.MD5.MD5Utils;
import com.dg11185.nearshop.app.Constants;
import com.dg11185.nearshop.net.HttpCacheRequest;
import com.dg11185.nearshop.net.response.GetActivityListResponse;

/**
 * 获取活动列表
 * @author：Daibo    
 * @time：2014-8-22 下午3:30:17
 */
public class GetActivityListRequest extends HttpCacheRequest<GetActivityListResponse> {

    public GetActivityListRequest(String areNum) {
        super(Constants.ADDRESS, Constants.getActivityList);
        addParam("areaNum", areNum);
        addParam("chshToken", Constants.TOKEN);
    }

    /**
     * <可选参数> 
     * <param name="activityName">活动名称</param> 
     * <param name="activityType">活动类型</param> 
     * <param name="pageNumber">当前页码</param>
     * <param name="pageSize">每页数量</param> 
     * <param name="orderName">排序字段</param>
     * <param name="orderType">0.升序，1.降序</param> 
     * </可选参数>
     */
    public GetActivityListRequest add(String key, String value) {
        addParam(key, value);
        return this;
    }

    public GetActivityListRequest encryption() {
        addParam("chshSign", MD5Utils.getMD5Str(getParams(), Constants.MD5_key));
        return this;
    }

    @Override
    protected GetActivityListResponse parseJson(String response) throws Exception {
        GetActivityListResponse r = new GetActivityListResponse();
        r.parseJson(response);
        return r;
    }

}
